package solitaire.presentation;

import java.awt.Color;
import java.awt.Graphics;

import javax.swing.JPanel;

import solitaire.controle.CTasDeCartesAlternees;

public class PTasDeCartesAlternees extends JPanel {
	
	private static final long serialVersionUID = -4145540164957956471L;

	private CTasDeCartesAlternees controle;
	private int nbCartes;
	
	public PTasDeCartesAlternees(CTasDeCartesAlternees controle) {
		this.controle = controle;
		setLayout(null);

		setSize(PCarte.largeur, PCarte.hauteur);
		setBorder(null);
		setPreferredSize(getSize());
	}

	public void depiler(PCarte carte) {
	}

	public void empiler(PCarte carte) {
		nbCartes++;
		add(carte, 0);
		
		carte.setLocation(0, (nbCartes - 1) * 15);
		
		setVisible(true);
		System.out.println("Added altern card.");
	}

	public void paint(Graphics g) {
		super.paint(g);
		g.setColor(Color.red);
		g.drawRect(0, 0, getWidth() - 1, getHeight() - 1);
	}
}